package architect.design.patterns.structural.decorator;

/**
 * 装饰抽象类
 *
 * @author guanxin
 * @date 2018/5/5 16:00
 */

public abstract class Decorator implements BakeryComponent {

    private BakeryComponent baseComponent = null;

    protected String name = "Undefined Decorator";
    protected double price = 0.0;

    protected Decorator(BakeryComponent baseComponent) {
        this.baseComponent = baseComponent;
    }

    public String getName() {
        return this.baseComponent.getName() + ", " + this.name;
    }

    public double getPrice() {
        return this.price + this.baseComponent.getPrice();
    }
}
